<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<title>个人中心</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<!--标准mui.css-->
		<link rel="stylesheet" href="css/mui.min.css">
		<!--App自定义的css-->
		<link rel="stylesheet" type="text/css" href="css/app.css" />
		<style type="text/css">
			html {
				font-size: 16px;
			}

			#app {
				padding-top: 44px;
			}

			.info {
				padding: 1.125rem;
				background-color: #FFFFFF;
			}

			.info img {
				width: 3.75rem;
				height: 3.75rem;
				border-radius: 50%;
				float: left;
			}

			.info .name {
				line-height: 3.75rem;
				margin-left: 0.9375rem;
				font-size: 1.25rem;
				color: #222222;
				font-weight: 500;
			}
			.info .name span{
				font-size: 0.875rem
			}

			.info .mui-btn {
				float: right;
				background: linear-gradient(180deg, #FF8E3C 0%, #FC6A02 100%);
				border: none;
				color: #FFFFFF;
				padding: 0.625rem 0.875rem;
				font-size: 0.875rem;
				line-height: 0.875rem;
				margin-top: 0.625rem;
			}

			.info .mui-btn:active {
				opacity: .8;
			}

			.list {
				margin-top: 0.625rem;
				font-size: 1rem;
			}
			.list .icon{
				width: 1.25rem;
				height: 1.25rem;
				position: relative;
				top: 0.25rem;
				margin-right: 0.625rem;
			}
			.list a {
				font-size: 14px;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-closeempty mui-pull-left"></a>
			<h1 class="mui-title">个人中心</h1>
		</header>
		<div id="app" v-cloak>
			<div class="info clearfix">
				<img :src="userinfo.avatar || 'images/logo.png'">
				<span class="name">{{userinfo.nickname}}<span>{{userinfo.department_name?"("+userinfo.department_name+")":""}}</span></span>
				<button type="button" class="mui-btn" @click="login" v-if="!userinfo.user_id">登录/注册</button>
				<button type="button" class="mui-btn" @click="clearLogin" v-else>退出登录</button>
			</div>
			<div class="list">
				<ul class="mui-table-view">
					<li class="mui-table-view-cell">
						<a class="mui-navigate-right" @click="toPublish"><img src="images/my_01.png" class="icon" >我的投稿</a>
					</li>
					<li class="mui-table-view-cell">
						<a class="mui-navigate-right" href="http://mm.chinapower.com.cn/dlxxh/wlw/"><img src="images/my_01.png" class="icon" >中国电力网</a>
					</li>
					<li class="mui-table-view-cell">
						<a class="mui-navigate-right" href="https://mp.weixin.qq.com/mp/homepage?__biz=MzI3MzAzMjMwNQ==&hid=5&sn=c13703448dc32a63a714da9511c51514&scene=18"><img src="images/my_01.png" class="icon">精彩国网</a>
					</li>
					<li class="mui-table-view-cell">
						<a class="mui-navigate-right" href="http://dangjian.com/"><img src="images/my_01.png" class="icon">党建要闻</a>
					</li>
				</ul>
			</div>
		</div>
		<nav class="mui-bar mui-bar-tab bottom-tab">
			<a class="mui-tab-item" href="index.html">
				<span class="mui-icon"><img src="images/tabbar_01.png" ></span>
				<span class="mui-tab-label">首页</span>
			</a>
			<a class="mui-tab-item" href="list_02.html">
				<span class="mui-icon"><img src="images/tabbar_02.png" ></span>
				<span class="mui-tab-label">随手拍</span>
			</a>
			<a class="mui-tab-item mui-active" href="my.html">
				<span class="mui-icon"><img src="images/tabbar_06.png" ></span>
				<span class="mui-tab-label">个人中心</span>
			</a>
		</nav>

		<script src="js/mui.js"></script>
		<script src="js/vue.js"></script>
		<script type="text/javascript">
			var app = new Vue({
				el: '#app',
				data: {
					userinfo: {},
				},
				methods: {
					login: function() {
						mui.openWindow("login.html")
					},
					clearLogin: function() {
						// 清除缓存
						this.userinfo = {};
						localStorage.removeItem("userinfo");
						localStorage.removeItem("token");
					},
					toPublish: function() {
						mui.openWindow("myPublish.html")
					}
				},

				created: function() {

				},
				mounted: function() {
					mui.init()
					if (localStorage.getItem("userinfo")) {
						this.userinfo = JSON.parse(localStorage.getItem("userinfo"))
					}
				}
			})
		</script>
	</body>

</html>
